package com.mmall.controller.backend;

import com.github.pagehelper.PageInfo;
import com.mmall.common.ServerResponse;
import com.mmall.service.IOrderService;
import com.mmall.vo.OrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * Created by geely
 */

@Controller
@RequestMapping("/manage/order")
public class OrderManageController {


    @Autowired
    private IOrderService iOrderService;

    @RequestMapping("list")
    @ResponseBody
    public ServerResponse<PageInfo> orderList(@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                              @RequestParam(value = "pageSize",defaultValue = "10")int pageSize){

            //登录验证交给过滤器
            //填充我们增加产品的业务逻辑
            return iOrderService.manageList(pageNum,pageSize);

    }

    @RequestMapping("detail")
    @ResponseBody
    public ServerResponse<OrderVo> orderDetail(Long orderNo){


            //填充我们增加产品的业务逻辑
//登录验证交给过滤器
            return iOrderService.manageDetail(orderNo);

    }



    @RequestMapping("search")
    @ResponseBody
    public ServerResponse<PageInfo> orderSearch(Long orderNo, @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                                @RequestParam(value = "pageSize",defaultValue = "10")int pageSize){

            //登录验证交给过滤器
            //填充我们增加产品的业务逻辑
            return iOrderService.manageSearch(orderNo,pageNum,pageSize);

    }

    @RequestMapping("send_goods")
    @ResponseBody
    public ServerResponse<String> orderSendGoods(Long orderNo){
            //登录验证交给过滤器
            //填充我们增加产品的业务逻辑
            return iOrderService.manageSendGoods(orderNo);
    }

}
